package com.across.connect.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.across.connect.util.CommonConst;
import com.across.connect.util.CookieManager;

public class LogoutAction extends Action{

	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		
		String logout = request.getParameter("logout");

		if ("yes".equalsIgnoreCase(logout)) {
			CookieManager.getInstance().clearCookie(response, CommonConst.COOKIE_USER_ID, 0, "/");
		}
		
		try {
			response.sendRedirect("login.do");
		} catch (Exception e) {
		}
		return null;
	}
}
